{% extends 'base_jgdw.html' %}
{% load staticfiles %}
{% block css %}
    <style>
        h3 {
            color: #c64743
        }
    </style>
{% endblock %}
{% block title %}
    <title>编辑单位信息</title>
{% endblock %}
{% block body %}
    <div class="container">
        <form class="form-horizontal" role="form" novalidate method="post" onsubmit="return myfun()">
            <h3>编辑单位信息</h3>
            {% csrf_token %}
            <!--基本信息-->
            <div class="row">
                <div class="panel panel-info">
                    <div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse1">
                        编辑单位信息
                    </div>
                    <div id="collapse1" class="panel-collapse collapse in">
                        <div class="panel-body">
                            <!-- 单位名称 -->
                            <div class="form-group col-md-3 {% if obj.title.errors.0 %}has-error{% endif %}">
                                <label for="id_title">{{ obj.title.label }}</label>
                                {{ obj.title }}
                                <span class="help-block">{{ obj.title.errors.0 }}</span>
                            </div>
                            <!-- 单位地址 -->
                            <div class="form-group col-md-3 {% if obj.address.errors.0 %}has-error{% endif %}">
                                <label for="id_address">{{ obj.address.label }}</label>
                                {{ obj.address }}
                                <span class="help-block">{{ obj.address.errors.0 }}</span>
                            </div>

                            <!-- 负责人 -->
                            <div class="form-group col-md-3 {% if obj.fzr.errors.0 %}has-error{% endif %}">
                                <label for="id_fzr">{{ obj.fzr.label }}</label>
                                {{ obj.fzr }}
                                <span class="help-block">{{ obj.fzr.errors.0 }}</span>
                            </div>
                            <!-- 负责人电话 -->
                            <div class="form-group col-md-3 {% if obj.phone1.errors.0 %}has-error{% endif %}">
                                <label for="id_phone1">{{ obj.phone1.label }}</label>
                                {{ obj.phone1 }}
                                <span class="help-block">{{ obj.phone1.errors.0 }}</span>
                            </div>
                            <!-- 联系人 -->
                            <div class="form-group col-md-3 {% if obj.lxr.errors.0 %}has-error{% endif %}">
                                <label for="id_lxr">{{ obj.lxr.label }}</label>
                                {{ obj.lxr }}
                                <span class="help-block">{{ obj.lxr.errors.0 }}</span>
                            </div>
                            <!-- 联系人电话 -->
                            <div class="form-group col-md-3 {% if obj.phone2.errors.0 %}has-error{% endif %}">
                                <label for="id_phone2">{{ obj.phone2.label }}</label>
                                {{ obj.phone2 }}
                                <span class="help-block">{{ obj.phone2.errors.0 }}</span>
                            </div>
                            <!-- 编制数量 -->
                            <div class="form-group col-md-3 {% if obj.bianzhi.errors.0 %}has-error{% endif %}">
                                <label for="id_bianzhi">{{ obj.bianzhi.label }}</label>
                                {{ obj.bianzhi }}
                                <span class="help-block">{{ obj.bianzhi.errors.0 }}</span>
                            </div>
                            <!-- 单位性质 -->
                            <div class="form-group col-md-3 {% if obj.dwxz.errors.0 %}has-error{% endif %}">
                                <label for="id_dwxz">{{ obj.dwxz.label }}</label>
                                {{ obj.dwxz }}
                                <span class="help-block">{{ obj.dwxz.errors.0 }}</span>
                            </div>
                            <!-- 执法车辆数 -->
                            <div class="form-group col-md-3 {% if obj.che.errors.0 %}has-error{% endif %}">
                                <label for="id_che">{{ obj.che.label }}</label>
                                {{ obj.che }}
                                <span class="help-block">{{ obj.che.errors.0 }}</span>
                            </div>
                            <!-- 执法经费 -->
                            <div class="form-group col-md-3 {% if obj.jingfei.errors.0 %}has-error{% endif %}">
                                <label for="id_jingfei">{{ obj.jingfei.label }}</label>
                                {{ obj.jingfei }}
                                <span class="help-block">{{ obj.jingfei.errors.0 }}</span>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <div class="col-md-6 col-md-offset-3" style="text-align: center;margin-top: 20px">
                <input type="reset" value="重置" class="btn btn-info">
                <input type="submit" value="提交" class="btn btn-success">
            </div>
        </form>
    </div>
{% endblock %}
{% block js %}
    <script>
        $('#id_xzqh').change(function () {
            $.ajax({
                url: "/hqdw/" + $(this).val() + "/",
                dataType: "json",
                success: function (d) {
                    if (d.n == 200) {
                        $("#id_organization").empty()
                        $.each(d.data, function (i, n) {
                            $("#id_organization").append('<option value="' + n[0] + '">' + n[1] + '</option>')
                        })
                    }

                }
            })
        })
    </script>
{% endblock %}